package com.lancoo.ccas52.arrangecourse.AlgDataSource.common;

import com.lancoo.ccas52.arrangecourse.entities.TeachingClassUnit;

import java.util.LinkedList;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @ClassName SchedulingProcessData
 * @Description 记录排课过程中的数据
 * @Author quin
 * @Date 2024/3/4 16:11
 */
public class SchedulingProcessData {

    /**
     * key为任务id
     * value为未排的排课教学班排课单元列表
     * todo key为 " '任务id'+ '-' + '学院id' "
     */
    public static  ConcurrentHashMap<Integer, LinkedList<TeachingClassUnit>> leaveListMap = new ConcurrentHashMap<>();



    /**
     * 添加未排的排课教学班排课单元列表
     * @param taskId 任务id
     * @param leaveList 未排的排课教学班排课单元列表
     */
    public static void addLeaveListMap(Integer taskId, LinkedList<TeachingClassUnit> leaveList){
        leaveListMap.merge(taskId, leaveList, (oldValue, newValue) -> {
            oldValue.addAll(newValue);
            return oldValue;
        });
    }

    public static void clearSchedulingProcessData(Integer taskId){
        //清空该任务的未排教学班
        leaveListMap.remove(taskId);
    }


}
